package com.jia.lidao.network.http.request.impl;

import com.jia.lidao.Constans;
import com.jia.lidao.enity.MessagetBeen;
import com.jia.lidao.network.http.request.AbstractRequest;
import com.lidroid.xutils.http.client.HttpRequest;

import org.apache.http.Header;

import java.lang.reflect.Type;
import java.util.List;

/**
 * 查询消息列表
 * 
 * Created by czhang on 17/12/18.
 */
public class MessagesRequest extends AbstractRequest {
	/**
	 * 页码
	 */
	private int page;
	/**
	 * 每页记录数
	 */
	private int page_size;
	/**
	 * 分类编号
	 */
	private int category_id;

	public MessagesRequest(int page, int page_size, int category_id) {
		this.page = page;
		this.page_size = page_size;
		this.category_id = category_id;
	}

	@Override
	public String getUrl() {
		return Constans.BASEURL + "/messages";
	}

	@Override
	public void initRequestParams() {
		addParam("page", String.valueOf(page));
		addParam("page_size", String.valueOf(page_size));
		addParam("category_id", String.valueOf(category_id));
	}

	@Override
	public List<Header> getHeaders() {
		return null;
	}

	@Override
	public Type getResultType() {
		return MessagetBeen.class;
	}

	@Override
	public HttpRequest.HttpMethod getRequestMethod() {
		return HttpRequest.HttpMethod.GET;
	}
}
